import { getToken } from "@/utils"
import { Navigate } from "react-router-dom"

function AuthRoute ({ children }) {
  const token = getToken()
  // token存在
  if (token) {
    return (<>{children}</>)
  } else { // token不存在或者失效
    return (<Navigate to='/login' replace />)
  }
}
export { AuthRoute }